﻿using System;
using Omu.Awesome.Mvc.Helpers;
using NUnit.Framework;

namespace Omu.Awesome.Test
{
    public class ExtensionsTests
    {
        [Test]
        public void GetController()
        {
            var x = "jora.book[0]";
            Console.WriteLine(x.GetController());

            x = "book";
            Console.WriteLine(x.GetController());

            x = "book[1232]";
            Console.WriteLine(x.GetController());

            x = "book[1]";
            Console.WriteLine(x.GetController());

            x = "jora.book";
            Console.WriteLine(x.GetController());

            x = "jora[132].book.aaa[13232].carte[112]";
            Console.WriteLine(x.GetController());
        }


        [Test]
        public void MakePropId()
        {
            var x = "halo[1].aaa[1]".MakePropId("{0}Id");
            Console.WriteLine(x);

            x = "aaa[1]".MakePropId("{0}Id");
            Console.WriteLine(x);

            x = "aaa".MakePropId("{0}Id");
            Console.WriteLine(x);

            x = "xxx.aaa[1]".MakePropId("{0}Id");
            Console.WriteLine(x);
        }
    }
}
